package com.sskj.mine.invite;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.allen.library.SuperTextView;
import com.sskj.common.base.App;
import com.sskj.common.util.ClickUtil;
import com.sskj.lib.RConfig;
import com.sskj.lib.base.BaseActivity;
import com.sskj.lib.util.CoinUtil;
import com.sskj.lib.util.NumberUtil;
import com.sskj.mine.MineInviteActivity;
import com.sskj.mine.R;
import com.sskj.mine.R2;
import com.sskj.mine.bean.MineInviteBean;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @author Hey
 * Create at  2019/05/03
 */
@Route(path = RConfig.MINE_INVITE)//邀请返佣
public class InviteActivity extends BaseActivity<InvitePresenter> {

    @BindView(R2.id.team_tv)
    TextView teamTv;
    @BindView(R2.id.team_layout)
    LinearLayout teamLayout;
    @BindView(R2.id.reward_tv)
    TextView rewardTv;
    @BindView(R2.id.reward_layout)
    LinearLayout rewardLayout;
    @BindView(R2.id.menu_invite)
    SuperTextView menuInvite;
    @BindView(R2.id.menu_account)
    SuperTextView menuAccount;
    @BindView(R2.id.menu_money)
    SuperTextView menuMoney;
    @BindView(R2.id.today_reward_tv)
    TextView todayRewardTv;


    @Override
    public int getLayoutId() {
        return R.layout.mine_activity_invite;
    }

    @Override
    public InvitePresenter getPresenter() {
        return new InvitePresenter();
    }

    @Override
    public void initView() {
        setTitle(App.INSTANCE.getString(R.string.mine_inviteActivity1_j));
        ClickUtil.click(menuInvite, () -> {
            MineInviteActivity.start(this);
        });

        ClickUtil.click(menuAccount, () -> {
            TeamActivity.start(this);
        });

        ClickUtil.click(menuMoney, () -> {
            RewardActivity.start(this);
        });
    }

    @Override
    public void initData() {
        mPresenter.getShareInfo();
    }

    public static void start(Context context) {
        Intent intent = new Intent(context, InviteActivity.class);
        context.startActivity(intent);
    }

    public void updateUi(MineInviteBean inviteInfo) {
        teamTv.setText(inviteInfo.getTtl());
        todayRewardTv.setText(NumberUtil.keepMax(inviteInfo.getToday_sum(), 8));
        rewardTv.setText(NumberUtil.keepMax(inviteInfo.getTotal_sum(), 8));
    }

}
